package org.vectrics.recruiter.struts.tag;

import java.util.Iterator;
import java.util.Locale;

import org.apache.ecs.html.Option;
import org.vectrics.common.html.Combo;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.document.CandidateDocumentCategory;
import org.vectrics.recruiter.user.resume.email.EmailedResumeAttachment;

public class EmailedResumeAttachmentCategoryCombo extends Combo {
	public static final long serialVersionUID = 34733376;

	
	public EmailedResumeAttachmentCategoryCombo(Locale locale, EmailedResumeAttachment attachment) {
		super();
		this.setClass("formComboClass");
		this.setName("attach_cat_" + attachment.getId());
		Iterator catIter = RecruitServiceLocator.getRecruitUserService().findAllCandidateDocumentCategories().iterator();
		while (catIter.hasNext()) {
			CandidateDocumentCategory cat = (CandidateDocumentCategory)catIter.next();
			Option option = this.addOption(cat.getDescription(locale), cat.getCode());
			if (cat.getCode().equals(attachment.getDocument().getCategory().getCode())) {
				option.setSelected(true);
			}
		}
	}
	

}
